package persistencia.homes;

import java.util.List;

import com.db4o.query.Predicate;

import persistencia.DBManager;

import artistas.ArtistaMusical;

import espectaculos.Gira;

public class GiraHome extends GenericHome {

    @SuppressWarnings("unchecked")
    static public List<Gira> listAll() {
        return (List<Gira>) GenericHome.listAll(Gira.class);
    }
    
    @SuppressWarnings({ "unchecked", "serial" })
	static public List<Gira> girasArtista(final ArtistaMusical artista) {
        return (List<Gira>) DBManager.getInstance().query(
        		new Predicate<Gira>(){
        			@Override
        			public boolean match(Gira gira) {
        				return  gira.getArtista().equals(artista);
        			}
        		}
        );
    }

    static public Gira get(final Gira g) {
        return (Gira) GenericHome.get(g);
    }
}
